<template>
    <!---数据表格-->
    <el-table :data="list" style="width: 100%">
        <el-table-column type="index" label="序号"/>
        <el-table-column prop="name" label="名称" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column label="操作" align="center" width="280" #default="scope">
            <el-button type="primary" size="small" @click="editShow(scope.row)">
                详情
            </el-button>
        </el-table-column>
    </el-table>

    <el-dialog v-model="dialogVisible" title="高血压评估结果" width="70%">
                        <el-form-item label="是否抽烟">
                            <el-radio-group v-model="pingg.yan">
                                <el-radio :label="2">是</el-radio>
                                <el-radio :label="1">否</el-radio>
                            </el-radio-group>
                        </el-form-item>

                        <el-form-item label="运动频率">
                            <el-radio-group v-model="pingg.yun">
                                <el-radio :label="1">经常</el-radio>
                                <el-radio :label="2">不运动</el-radio>
                            </el-radio-group>
                        </el-form-item>

                        <el-form-item label="饮食习惯">
                            <el-radio-group v-model="pingg.yin">
                                <el-radio :label="2">偏高盐</el-radio>
                                <el-radio :label="1">健康饮食</el-radio>
                            </el-radio-group>
                        </el-form-item>

                        <el-form-item label="家族中是否有高血压、心血管疾病等相关疾病的患者？">
                            <el-radio-group v-model="pingg.yichaun">
                                <el-radio :label="2">是</el-radio>
                                <el-radio :label="1">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="收缩压">
                            <el-text/>{{ pingg.shousuo }}
                        </el-form-item>
                        <el-form-item label="舒张压">
                            <el-text/>{{ pingg.shuzhang }}
                        </el-form-item>

                        <el-form-item label="是否患有高血压">
                            <el-text/>{{ pingg.shifou }}
                        </el-form-item>

                        <el-form-item label="患有高血压的等级:" v-if="pingg.weilai=='无'">
                            <el-text/>{{ pingg.dengji }}
                        </el-form-item>

                        <el-form-item label="未患有高血压，会患有高雪血的等级:" v-if="pingg.dengji=='无'">
                            <el-text/>{{ pingg.weilai }}
                        </el-form-item>
                </el-dialog> 
</template>

<script setup>
import { ref,onMounted } from 'vue'; 
import { findJilu,findJiluById } from '@/api/jilu';
import { ElMessage,ElMessageBox } from 'element-plus';

const list = ref([])

const pingg = ref({
  name:'高血压评估',
  yan:'',
  yun:'',
  yin:'',
  yichaun:'',
  shuzhang:'',
  shousuo:'',
  shifou:'',
  dengji:'',
  weilai:''
})
onMounted(()=>{
    findJiluAll()
})
const findJiluAll = async()=>{
    const {data} = await findJilu()
    list.value = data
}
const dialogVisible = ref(false)

const editShow = async(row)=>{
    dialogVisible.value = true
    const {data} = await findJiluById(row.id)
    pingg.value = data
}

</script>

<style lang="scss" scoped>

</style>